home *** CD-ROM | disk | FTP | other *** search
/ Best Tools for JAVA / Best Tools for JAVA.iso / POSTSCPT / GSVIEW / SRC / GVCCMD.C < prev    next >
Encoding:
C/C++ Source or Header  |  1995-12-17  |  16.1 KB  |  687 lines

  1. /* Copyright (C) 1993, 1994, 1995, Russell Lang.  All rights reserved.
  2.   
  3.   This file is part of GSview.
  4.   
  5.   This program is distributed with NO WARRANTY OF ANY KIND.  No author
  6.   or distributor accepts any responsibility for the consequences of using it,
  7.   or for whether it serves any particular purpose or works at all, unless he
  8.   or she says so in writing.  Refer to the GSview Free Public Licence 
  9.   (the "Licence") for full details.
  10.   
  11.   Every copy of GSview must include a copy of the Licence, normally in a 
  12.   plain ASCII text file named LICENCE.  The Licence grants you the right 
  13.   to copy, modify and redistribute GSview, but only under certain conditions 
  14.   described in the Licence.  Among other things, the Licence requires that 
  15.   the copyright notice and this notice be preserved on all copies.
  16. */
  17.  
  18. /* gvccmd.c */
  19. /* Menu command module of PM and Windows GSview */
  20.  
  21. #ifdef _Windows
  22. #include "gvwin.h"
  23. #else
  24. #include "gvpm.h"
  25. #endif
  26.  
  27. void gsview_depth(int new_depth);
  28. void gsview_gsversion(int new_version);
  29. BOOL gsview_usersize(void);
  30. void gsview_unzoom(void);
  31. void gsview_drawmethod(int new_drawmethod);
  32.  
  33. /* gsview menu commands */
  34. int
  35. gsview_command(int command)
  36. {
  37. char prompt[MAXSTR];        /* input dialog box prompt and message box string */
  38. char answer[MAXSTR];        /* input dialog box answer string */
  39.     switch (command) {
  40.     case IDM_OPEN:
  41.         dfreopen();
  42.         gsview_display();
  43.         dfclose();
  44.         return 0;
  45.     case IDM_CLOSE:
  46.         dfreopen();
  47.             if (gsprog.valid)
  48.             gsview_endfile();
  49.         gsview_unzoom();
  50.         psfile.name[0] = '\0';
  51.         dfclose();
  52.         if (page_list.select)
  53.             free(page_list.select);
  54.         page_list.select = NULL;
  55.         if (doc)
  56.             psfree(doc);
  57.         doc = (PSDOC *)NULL;
  58.         return 0;
  59.     case IDM_NEXT:
  60.         if (not_open())
  61.             return 0;
  62.         if (doc==(PSDOC *)NULL) {
  63.             if (!gs_open())
  64.                 return 0;
  65.             if (is_pipe_done()) {
  66.             play_sound(SOUND_NOPAGE);
  67.             }
  68.             else {
  69.             psfile.pagenum++;
  70.             next_page();
  71.             }
  72.             return 0;
  73.         }
  74.         dfreopen();
  75.         gsview_unzoom();
  76.         dsc_skip(1+page_extra);
  77.         page_extra = 0;
  78.         dfclose();
  79.         return 0;
  80.     case IDM_NEXTSKIP:
  81.         if (not_dsc())
  82.             return 0;
  83.         dfreopen();
  84.         gsview_unzoom();
  85.         dsc_skip(page_skip+page_extra);
  86.         page_extra = 0;
  87.         dfclose();
  88.         return 0;
  89.     case IDM_REDISPLAY:
  90.         if (not_open())
  91.             return 0;
  92.         if (doc==(PSDOC *)NULL) {
  93.             /* don't know where we are so close and reopen */
  94.             if (!is_pipe_done())
  95.             gs_close();
  96.         }
  97.         if (!gs_open())
  98.             return 0;
  99.         if (!dfreopen()) {
  100.             gserror(0, "Someone deleted the file!", MB_ICONEXCLAMATION, SOUND_ERROR);
  101.             return 0;
  102.          }
  103.         gsview_unzoom();
  104.         if (display.page)
  105.             next_page(); 
  106.         if ((doc==(PSDOC *)NULL) || (doc->pages==0)) {
  107.             gsview_displayfile(psfile.name);
  108.             dfclose();
  109.             return 0;
  110.         }
  111.         dsc_dopage();
  112.         dfclose();
  113.         return 0;
  114.     case IDM_PREV:
  115.         if (not_dsc())
  116.             return 0;
  117.         dfreopen();
  118.         gsview_unzoom();
  119.         dsc_skip(-1+page_extra);
  120.         page_extra = 0;
  121.         dfclose();
  122.         return 0;
  123.     case IDM_PREVSKIP:
  124.         if (not_dsc())
  125.             return 0;
  126.         dfreopen();
  127.         gsview_unzoom();
  128.         dsc_skip(-page_skip+page_extra);
  129.         page_extra = 0;
  130.         dfclose();
  131.         return 0;
  132.     case IDM_GOTO:
  133.         if (not_dsc())
  134.             return 0;
  135.         dfreopen();
  136.         gsview_unzoom();
  137.         load_string(IDS_TOPICGOTO, szHelpTopic, sizeof(szHelpTopic));
  138.         if (doc->numpages == 0) {
  139.             gserror(IDS_NOPAGE, NULL, MB_ICONEXCLAMATION, SOUND_NONUMBER);
  140.         }
  141.         else if (get_page(&psfile.pagenum, FALSE)) {
  142.             if (psfile.pagenum > doc->numpages) {
  143.             psfile.pagenum = doc->numpages;
  144.             play_sound(SOUND_NOPAGE);
  145.             }
  146.             else if (psfile.pagenum < 1) {
  147.             psfile.pagenum = 1;
  148.             play_sound(SOUND_NOPAGE);
  149.             }
  150.             else {
  151.             if (gs_open()) {
  152.                 if (display.page)
  153.                     next_page();
  154.                 dsc_dopage();
  155.             }
  156.             }
  157.         }
  158.         dfclose();
  159.         return 0;
  160.     case IDM_INFO:
  161.         show_info();
  162.         return 0;
  163.     case IDM_SELECT:
  164.         gsview_select();
  165.         dfclose();
  166.         return 0;
  167.     case IDM_PRINT:
  168.         if (psfile.name[0] == '\0')
  169.             gsview_select();
  170.         dfreopen();
  171.         if (psfile.name[0] != '\0')
  172.             gsview_print(FALSE);
  173.         dfclose();
  174.         return 0;
  175.     case IDM_PRINTTOFILE:
  176.         if (psfile.name[0] == '\0')
  177.             gsview_select();
  178.         dfreopen();
  179.         if (psfile.name[0] != '\0')
  180.             gsview_print(TRUE);
  181.         dfclose();
  182.         return 0;
  183.     case IDM_SPOOL:
  184.         gsview_spool((char *)NULL, (char *)NULL);
  185.         return 0;
  186.     case IDM_SAVEAS:
  187.         if (psfile.name[0] == '\0')
  188.             gsview_select();
  189.         dfreopen();
  190.         if (psfile.name[0] != '\0')
  191.             gsview_saveas();
  192.         dfclose();
  193.         return 0;
  194.     case IDM_EXTRACT:
  195.         if (psfile.name[0] == '\0')
  196.             gsview_select();
  197.         dfreopen();
  198.         if (psfile.name[0] != '\0')
  199.             gsview_extract();
  200.         dfclose();
  201.         return 0;
  202.     case IDM_TEXTEXTRACT:
  203.         if (psfile.name[0] == '\0')
  204.             gsview_select();
  205.         dfreopen();
  206.         if (psfile.name[0] != '\0')
  207.             gsview_text_extract();
  208.         dfclose();
  209.         return 0;
  210.     case IDM_TEXTFIND:
  211.         gsview_text_find();
  212.         return 0;
  213.     case IDM_TEXTFINDNEXT:
  214.         gsview_text_findnext();
  215.         return 0;
  216.     case IDM_EXIT:
  217.         post_close();
  218.         return 0;
  219.     case IDM_COPYCLIP:
  220.         copy_clipboard();
  221.         return 0;
  222.     case IDM_PASTETO:
  223.         paste_to_file();
  224.         return 0;
  225.     case IDM_CONVERT:
  226.         clip_convert();
  227.         return 0;
  228.     case IDM_GSCOMMAND:
  229.             install_gsexe();
  230. #ifdef OLD
  231.         load_string(IDS_GSCOMMAND, prompt, sizeof(prompt));
  232.         strcpy(answer, option.gscommand);
  233.         load_string(IDS_TOPICGSCMD, szHelpTopic, sizeof(szHelpTopic));
  234.         if (get_string(prompt,answer))
  235.             strcpy(option.gscommand, answer);
  236.         if (option.gscommand[0]=='\0')
  237.             strcpy(option.gscommand, DEFAULT_GSCOMMAND);
  238. #endif
  239.         return 0;
  240.     case IDM_GS351:
  241.     case IDM_GS333:
  242.     case IDM_GS261:
  243.         gsview_gsversion(command);
  244.         return 0;
  245.     case IDM_DRAWDEF:
  246.     case IDM_DRAWGPI:
  247.     case IDM_DRAWWIN:
  248.         gsview_drawmethod(command);
  249.         return 0;
  250.     case IDM_UNITPT:
  251.     case IDM_UNITMM:
  252.     case IDM_UNITINCH:
  253.         gsview_unit(command);
  254.         return 0;
  255.     case IDM_SAFER:
  256.         option.safer = !option.safer;
  257.         check_menu_item(IDM_OPTIONMENU, IDM_SAFER, option.safer);
  258.         return 0;
  259.     case IDM_SAVEDIR:
  260.         option.save_dir = !option.save_dir;
  261.         check_menu_item(IDM_OPTIONMENU, IDM_SAVEDIR, option.save_dir);
  262.         return 0;
  263.     case IDM_BUTTONSHOW:
  264.         option.button_show = !option.button_show;
  265.         check_menu_item(IDM_OPTIONMENU, IDM_BUTTONSHOW, option.button_show);
  266.         show_buttons();
  267.         return 0;
  268.     case IDM_FITPAGE:
  269.         option.fit_page = !option.fit_page;
  270.         check_menu_item(IDM_OPTIONMENU, IDM_FITPAGE, option.fit_page);
  271.         /* should cause WM_SIZE message to be sent */
  272.         return 0;
  273.     case IDM_QUICK:
  274.         option.quick = !option.quick;
  275.         check_menu_item(IDM_OPTIONMENU, IDM_QUICK, option.quick);
  276.         return 0;
  277.     case IDM_AUTOREDISPLAY:
  278.         option.redisplay = !option.redisplay;
  279.         check_menu_item(IDM_OPTIONMENU, IDM_AUTOREDISPLAY, option.redisplay);
  280.         return 0;
  281.     case IDM_EPSFCLIP:
  282.         option.epsf_clip = !option.epsf_clip;
  283.         check_menu_item(IDM_OPTIONMENU, IDM_EPSFCLIP, option.epsf_clip);
  284.         gs_resize();
  285.         return 0;
  286.     case IDM_EPSFWARN:
  287.         option.epsf_warn = !option.epsf_warn;
  288.         check_menu_item(IDM_OPTIONMENU, IDM_EPSFWARN, option.epsf_warn);
  289.         return 0;
  290.     case IDM_IGNOREDSC:
  291.         option.ignore_dsc = !option.ignore_dsc;
  292.         check_menu_item(IDM_OPTIONMENU, IDM_IGNOREDSC, option.ignore_dsc);
  293.         if (psfile.name[0]) {
  294.             if (option.redisplay)
  295.                 gsview_displayfile(psfile.name);
  296.             else
  297.                 gsview_selectfile(psfile.name);
  298.         }
  299.         return 0;
  300.     case IDM_SHOWBBOX:
  301.         option.show_bbox = !option.show_bbox;
  302.         check_menu_item(IDM_OPTIONMENU, IDM_SHOWBBOX, option.show_bbox);
  303. #ifdef _Windows
  304.         PostMessage(hwndimg, WM_GSVIEW, SYNC_OUTPUT, 0L);
  305. #else
  306.         if (!WinInvalidateRect(hwnd_bmp, (PRECTL)NULL, TRUE))
  307.             error_message("error invalidating rect");
  308.           if (!WinUpdateWindow(hwnd_bmp))
  309.             error_message("error updating window");
  310. #endif
  311.         return 0;
  312.     case IDM_PSTOEPS:
  313.         if (psfile.name[0] == '\0')
  314.             gsview_display();
  315.         if (psfile.name[0] != '\0') {
  316.             dfreopen();
  317.             ps_to_eps();
  318.             dfclose();
  319.         }
  320.         return 0;
  321.     case IDM_MAKEEPSI:
  322.         dfreopen();
  323.         make_eps_interchange(FALSE);
  324.         dfclose();
  325.         return 0;
  326.     case IDM_MAKEEPST4:
  327.     case IDM_MAKEEPST:
  328.         dfreopen();
  329.         make_eps_tiff(command, FALSE);
  330.         dfclose();
  331.         return 0;
  332.     case IDM_MAKEEPSW:
  333.         dfreopen();
  334.         make_eps_metafile();
  335.         dfclose();
  336.         return 0;
  337.     case IDM_MAKEEPSU:
  338.         dfreopen();
  339.         make_eps_user();
  340.         dfclose();
  341.         return 0;
  342.     case IDM_EXTRACTPS:
  343.     case IDM_EXTRACTPRE:
  344.         dfreopen();
  345.         extract_doseps(command);
  346.         dfclose();
  347.         return 0;
  348.     case IDM_SETTINGS:
  349.         write_profile();
  350.         return 0;
  351.     case IDM_SAVESETTINGS:
  352.         option.settings = !option.settings;
  353.         check_menu_item(IDM_OPTIONMENU, IDM_SAVESETTINGS, option.settings);
  354.         sprintf(prompt, "%d", option.settings);
  355.         { PROFILE *prf = profile_open(szIniFile);
  356.           profile_write_string(prf, INISECTION, "SaveSettings", prompt);
  357.           profile_close(prf);
  358.         }
  359.         return 0;
  360.     case IDM_SOUNDS:
  361.         change_sounds();
  362.         return 0;
  363.     case IDM_PORTRAIT:
  364.     case IDM_LANDSCAPE:
  365.     case IDM_UPSIDEDOWN:
  366.     case IDM_SEASCAPE:
  367.     case IDM_SWAPLANDSCAPE:
  368.         dfreopen();
  369.         gsview_orientation(command);
  370.         dfclose();
  371.         return 0;
  372.     case IDM_RESOLUTION:
  373.         load_string(IDS_RES, prompt, sizeof(prompt));
  374.         if (option.xdpi == option.ydpi)
  375.             sprintf(answer,"%g", option.xdpi);
  376.         else 
  377.             sprintf(answer,"%g %g", option.xdpi, option.ydpi);
  378.         load_string(IDS_TOPICMEDIA, szHelpTopic, sizeof(szHelpTopic));
  379.         if (get_string(prompt,answer)) {
  380.             switch (sscanf(answer,"%f %f", &option.xdpi, &option.ydpi)) {
  381.               case EOF:
  382.               case 0:
  383.             return 0;
  384.               case 1:
  385.             option.ydpi = option.xdpi;
  386.               case 2:
  387.             if (option.xdpi==0.0)
  388.                 option.xdpi = DEFAULT_RESOLUTION;
  389.             if (option.ydpi==0.0)
  390.                 option.ydpi = DEFAULT_RESOLUTION;
  391.             dfreopen();
  392.             gs_resize();
  393.             gsview_unzoom();
  394.             dfclose();
  395.             }
  396.         }
  397.         return 0;
  398.     case IDM_ZOOMRES:
  399.         load_string(IDS_ZOOMRES, prompt, sizeof(prompt));
  400.         if (option.zoom_xdpi == option.zoom_ydpi)
  401.             sprintf(answer,"%g", option.zoom_xdpi);
  402.         else 
  403.             sprintf(answer,"%g %g", option.zoom_xdpi, option.zoom_ydpi);
  404.         load_string(IDS_TOPICMEDIA, szHelpTopic, sizeof(szHelpTopic));
  405.         if (get_string(prompt,answer)) {
  406.             switch (sscanf(answer,"%f %f", &option.zoom_xdpi, &option.zoom_ydpi)) {
  407.               case EOF:
  408.               case 0:
  409.             return 0;
  410.               case 1:
  411.             option.zoom_ydpi = option.zoom_xdpi;
  412.               case 2:
  413.             if (option.zoom_xdpi==0.0)
  414.                 option.zoom_xdpi = DEFAULT_RESOLUTION;
  415.             if (option.zoom_ydpi==0.0)
  416.                 option.zoom_ydpi = DEFAULT_RESOLUTION;
  417.             dfreopen();
  418.             gsview_unzoom();
  419.             dfclose();
  420.             }
  421.         }
  422.         return 0;
  423.     case IDM_ZOOM:        /* called indirectly from Right Mouse Button */
  424.         if (not_dsc()) {
  425.             zoom = FALSE;
  426.             return 0;
  427.         }
  428.         if (!(display.page || display.sync)) {
  429.             zoom = FALSE;
  430.                 gserror(IDS_NOZOOM, NULL, MB_ICONEXCLAMATION, SOUND_ERROR);
  431.                 return 0;
  432.         }
  433.         dfreopen();
  434.         if (display.page)
  435.             next_page(); 
  436.         gs_resize();
  437.         if ((doc==(PSDOC *)NULL) || (doc->pages==0)) {
  438.             gsview_displayfile(psfile.name);
  439.             dfclose();
  440.             return 0;
  441.         }
  442.         dsc_dopage();
  443.         dfclose();
  444.         return 0;
  445.     case IDM_MAGPLUS:
  446.         gs_magnify(1.2);
  447.         return 0;
  448.     case IDM_MAGMINUS:
  449.         gs_magnify(0.8333);
  450.         return 0;
  451.     case IDM_DEPTHDEF:
  452.     case IDM_DEPTH1:
  453.     case IDM_DEPTH4:
  454.     case IDM_DEPTH8:
  455.     case IDM_DEPTH16:
  456.     case IDM_DEPTH24:
  457.         gsview_depth(command);
  458.         return 0;
  459.     case IDM_LETTER:
  460.     case IDM_LETTERSMALL:
  461.     case IDM_TABLOID:
  462.     case IDM_LEDGER:
  463.     case IDM_LEGAL:
  464.     case IDM_STATEMENT:
  465.     case IDM_EXECUTIVE:
  466.     case IDM_A3:
  467.     case IDM_A4:
  468.     case IDM_A4SMALL:
  469.     case IDM_A5:
  470.     case IDM_B4:
  471.     case IDM_B5:
  472.     case IDM_FOLIO:
  473.     case IDM_QUARTO:
  474.     case IDM_10X14:
  475.     case IDM_USERSIZE:
  476.         if (command == IDM_USERSIZE)
  477.             if (!gsview_usersize())
  478.             return 0;
  479.         dfreopen();
  480.         gsview_media(command);
  481.         dfclose();
  482.         return 0;
  483.     case IDM_HELPCONTENT:
  484. #ifdef _Windows
  485.         WinHelp(hwndimg,szHelpName,HELP_CONTENTS,(DWORD)NULL);
  486. #else
  487.         WinSendMsg(hwnd_help, HM_HELP_CONTENTS, 0L, 0L);
  488. #endif
  489.         return 0;
  490.     case IDM_HELPSEARCH:
  491. #ifdef _Windows
  492.         WinHelp(hwndimg,szHelpName,HELP_PARTIALKEY,(DWORD)"");
  493. #else
  494.         WinSendMsg(hwnd_help, HM_HELP_INDEX, 0L, 0L);
  495. #endif
  496.         return 0;
  497.     case IDM_HELPKEYS:
  498.         load_string(IDS_TOPICKEYS, szHelpTopic, sizeof(szHelpTopic));
  499.         get_help();
  500.         return 0;
  501.     case IDM_ABOUT:
  502.         show_about();
  503.         return 0;
  504.     }
  505.     return 0;
  506. }
  507.  
  508. /* if no document open, display error message and return true */
  509. BOOL
  510. not_open()
  511. {
  512.     if (psfile.name[0] != '\0')
  513.         return FALSE;
  514.     gserror(IDS_NOTOPEN, NULL, MB_ICONEXCLAMATION, SOUND_NOTOPEN);
  515.     return TRUE;
  516. }
  517.  
  518. /* if not DSC document or not open, display error message and return true */
  519. BOOL
  520. not_dsc()
  521. {
  522.     if (not_open())
  523.         return TRUE;
  524.     if (doc!=(PSDOC *)NULL)
  525.         return FALSE;
  526.     gserror(IDS_NOPAGE, NULL, MB_ICONEXCLAMATION, SOUND_NONUMBER);
  527.     return TRUE;
  528. }
  529.  
  530. void
  531. gserror(UINT id, char *str, UINT icon, int sound)
  532. {
  533. int i;
  534. char mess[300];
  535.     info_wait(IDS_NOWAIT);
  536.     if (sound >= 0)
  537.         play_sound(sound);
  538.     i = 0;
  539.     if (id)
  540.         i = load_string(id, mess, sizeof(mess)-1);
  541.     mess[i] = '\0';
  542.     if (str)
  543.         strncpy(mess+i, str, sizeof(mess)-i-1);
  544.     message_box(mess, icon);
  545. }
  546.  
  547. /* for ps.c errors instead of fprintf(stderr,...)! */
  548. void
  549. pserror(char *str)
  550. {
  551.     message_box(str, MB_ICONHAND);
  552. }
  553.  
  554.  
  555. int
  556. not_implemented()
  557. {
  558.     message_box("Not implemented",0);
  559.     return 0;
  560. }
  561.  
  562. /* get user defined size */
  563. BOOL
  564. gsview_usersize()
  565. {
  566. char prompt[MAXSTR];
  567. char answer[MAXSTR];
  568.     load_string(IDS_TOPICMEDIA, szHelpTopic, sizeof(szHelpTopic));
  569.     load_string(IDS_USERWIDTH, prompt, sizeof(prompt));
  570.     sprintf(answer,"%d", option.user_width);
  571.     if (!get_string(prompt,answer) || atoi(answer)==0)
  572.         return FALSE;
  573.     option.user_width = atoi(answer);
  574.         gsview_check_usersize();
  575.     load_string(IDS_USERHEIGHT, prompt, sizeof(prompt));
  576.     sprintf(answer,"%d", option.user_height);
  577.     if (!get_string(prompt,answer) || atoi(answer)==0)
  578.         return FALSE;
  579.     option.user_height = atoi(answer);
  580.     if ((option.user_width==0) || (option.user_height == 0)) {
  581.         option.user_width = 640;
  582.         option.user_width = 480;
  583.     }
  584.         gsview_check_usersize();
  585.     return TRUE;
  586. }
  587.  
  588. void
  589. gsview_check_usersize()
  590. {
  591.     if ( (option.user_width > 2880) || (option.user_height > 4100) ) {
  592.         play_sound(SOUND_ERROR);
  593.         message_box("Warning: media size is wider than 1 metre or higher than 1 metre.  Please check 'Media | User Defined'", 0);
  594.     }
  595. }
  596.  
  597. int
  598. gsview_depth_to_menu(int depth)
  599. {
  600.     switch(depth) {
  601.         case 1:
  602.         return IDM_DEPTH1;
  603.         case 4:
  604.         return IDM_DEPTH4;
  605.         case 8:
  606.         return IDM_DEPTH8;
  607.         case 16:
  608.         return IDM_DEPTH16;
  609.         case 24:
  610.         return IDM_DEPTH24;
  611.     }
  612.     return IDM_DEPTHDEF;
  613. }
  614.  
  615. int imenu[] = {0, 1, 4, 8, 16, 24, 0};
  616. void
  617. gsview_depth(int new_depth)
  618. {
  619. int old_depth;
  620. BOOL redisplay = FALSE;
  621.     switch(option.depth) {
  622.         case 1:
  623.         old_depth = IDM_DEPTH1;
  624.         break;
  625.         case 4:
  626.         old_depth = IDM_DEPTH4;
  627.         break;
  628.         case 8:
  629.         old_depth = IDM_DEPTH8;
  630.         break;
  631.         case 16:
  632.         old_depth = IDM_DEPTH16;
  633.         break;
  634.         case 24:
  635.         old_depth = IDM_DEPTH24;
  636.         break;
  637.         default:
  638.         old_depth = IDM_DEPTHDEF;
  639.     }
  640.     if (new_depth == old_depth)
  641.         return;
  642.     check_menu_item(IDM_DEPTHMENU, old_depth, FALSE);
  643.     option.depth = imenu[new_depth - IDM_DEPTHDEF];
  644.     check_menu_item(IDM_DEPTHMENU, new_depth, TRUE);
  645.     if (gsprog.valid) {
  646.         if (option.redisplay && display.page && (doc != (PSDOC *)NULL))
  647.            redisplay = TRUE;
  648.         /* can't change depth with a postscript command so must close gs */
  649.         gs_close();
  650.         if (redisplay)
  651.         display.do_display = TRUE;
  652.     }
  653.     return;
  654. }
  655.  
  656. /* unzoom when redisplaying or changing page */ 
  657. void
  658. gsview_unzoom(void)
  659. {
  660.     if (zoom) {
  661.         gs_resize();
  662.         zoom = FALSE;
  663.     }
  664. }
  665.  
  666. /* allow GS 2.6.1 to be used with 16-bit GSview */
  667. void
  668. gsview_gsversion(int new_version)
  669. {
  670.     check_menu_item(IDM_GSVERMENU, option.gsversion, FALSE);
  671.     option.gsversion = new_version;
  672.     check_menu_item(IDM_GSVERMENU, option.gsversion, TRUE);
  673.     info_wait(IDS_NOWAIT);
  674.     return;
  675. }
  676.  
  677. /* allow OS/2 to select the API for drawing the bitmap */
  678. void
  679. gsview_drawmethod(int new_drawmethod)
  680. {
  681.     check_menu_item(IDM_DRAWMENU, option.drawmethod, FALSE);
  682.     option.drawmethod = new_drawmethod;
  683.     check_menu_item(IDM_DRAWMENU, option.drawmethod, TRUE);
  684.     return;
  685. }
  686.  
  687.